package com.zhangdi.dwweb.listener;


/**
 * Created by zhangdi on 2020/01/20 10:52:26.
 */

//public class ApplicationStartedListener implements ApplicationListener<ApplicationStartedEvent> {

//    @Override
//    public void onApplicationEvent(ApplicationStartedEvent event) {
//        refreshFilterChain(event.getApplicationContext());
//    }
//
//    private void refreshFilterChain(ApplicationContext context) {
//        ShiroService shiroService = context.getBean(ShiroService.class);
//        AbstractShiroFilter shiroFilter = context.getBean(AbstractShiroFilter.class);
//
//        PathMatchingFilterChainResolver filterChainResolver = (PathMatchingFilterChainResolver) shiroFilter
//                .getFilterChainResolver();
//        DefaultFilterChainManager filterChainManager = (DefaultFilterChainManager) filterChainResolver
//                .getFilterChainManager();
//
////        filterChainManager.getFilterChains().clear();
//        Map<String, String> filterChainDefinitionMap = shiroService.getFromCache("sys");
//        for (Map.Entry<String, String> entry : filterChainDefinitionMap.entrySet()) {
//            String url = entry.getKey();
//            String chainDefinition = entry.getValue().trim()
//                    .replace(" ", "");
//            filterChainManager.createChain(url, chainDefinition);
//        }
//    }
//}
